<%@ page language="java"
         contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"
         import="com.shxt.hotel.background.Room"
         import="com.shxt.hotel.background.User"
         import="java.util.List"
         import="java.util.Map"
%>
<%
    Room room = new Room();
    User user = new User();
    
    Map<String, Object> currentUser;
    
    if(session.getAttribute("id") == null){
        response.sendRedirect("./login.jsp");
    }else{
        currentUser = user.getUserInfo((int)session.getAttribute("id"));
%>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="../Public/img/favicon.html">

    <title>Hotel</title>

    <!-- Bootstrap core CSS -->
    <link href="../Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="../Public/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="../Public/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="../Public/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css" media="screen" />
    <link rel="stylesheet" href="../Public/css/owl.carousel.css" type="text/css">
    <!-- Custom styles for this template -->
    <link href="../Public/css/style.css" rel="stylesheet">
    <link href="../Public/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="../Public/js/html5shiv.js"></script>
      <script src="../Public/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>

    <section id="container" class="">
        <!--header start-->
        <jsp:include page="./Public/header.jsp" flush="true"/>
        <!--header end-->
        <!--sidebar start-->
        <jsp:include page="./Public/sidebar.jsp" flush="true"/>
        <!--sidebar end-->
        <!--main content start-->
        <section id="main-content">
            <section class="wrapper">
                <!--state overview start-->
                <div class="row state-overview">
                    <div class="col-lg-3 col-sm-6">
                        <section class="panel">
                            <div class="symbol terques">
                                <i class="icon-user"></i>
                            </div>
                            <div class="value">
                                <h1>22</h1>
                                <p>Profiles</p>
                            </div>
                        </section>
                    </div>
                    <div class="col-lg-3 col-sm-6">
                        <section class="panel">
                            <div class="symbol red">
                                <i class="icon-tags"></i>
                            </div>
                            <div class="value">
                                <h1>140</h1>
                                <p>Sales</p>
                            </div>
                        </section>
                    </div>
                    <div class="col-lg-3 col-sm-6">
                        <section class="panel">
                            <div class="symbol yellow">
                                <i class="icon-shopping-cart"></i>
                            </div>
                            <div class="value">
                                <h1>345</h1>
                                <p>Consume</p>
                            </div>
                        </section>
                    </div>
                    <div class="col-lg-3 col-sm-6">
                        <section class="panel">
                            <div class="symbol blue">
                                <i class="icon-bar-chart"></i>
                            </div>
                            <div class="value">
                                <h1>34,500</h1>
                                <p>Total Profit</p>
                            </div>
                        </section>
                    </div>
                </div>
                <!--state overview end-->

                <div class="row">
                    <div class="col-lg-12">
                        <section class="panel panel-primary">
                            <header class="panel-heading">Room List</header>
                            <div class="panel-body">
                                <table class="table table-striped table-advance table-hover">
                                    <thead>
                                    <tr>
                                        <th><i class="icon-bullhorn"></i> Room Type</th>
                                        <th><i class="icon-bookmark"></i> Price</th>
                                        <th><i class="icon-bookmark-empty"></i> Bed</th>
                                        <th><i class="icon-edit"></i> Wifi</th>
                                        <th>Bathroom</th>
                                        <th>Area</th>
                                        <th>Operation</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <%
                                        // get all rooms
                                        // List<Map<String, Object>> roomList = room.getRooms();
                                        List<Map<String, Object>> categoryList = room.getCategories("*");
                                        
                                        for(int i = 0; i < categoryList.size(); i++){
                                            // Map<String, Object> room_rec = roomList.get(i);
                                            // int roomCategory = (int)room_rec.get("category");
                                            // Map<String, Object> cate = categoryList.get(roomCategory);
                                    %>
                                        <tr class="odd gradeX">
                                            <td form-data="room_category"><a href="#"><%=categoryList.get(i).get("title") %></a></td>
                                            <td class="hidden-phone" form-data="price"><span class="">$ &nbsp;</span><%=categoryList.get(i).get("price") %></td>
                                            <td class="hidden-phone" form-data="bed">
                                                <%
                                                    int bedInfo = (int)categoryList.get(i).get("bed");
                                                    if(bedInfo == 1){
                                                %>
                                                    <span class="label label-primary"><span class="icon-male"></span>&nbsp; Single</span>
                                                <%
                                                    }else{
                                                %>
                                                    <span class="label label-primary"><span class="icon-male"></span><span class="icon-female"></span> Double</span>
                                                <%
                                                    }
                                                %>
                                            </td>
                                            <td class="hidden-phone" form-data="wifi">
                                                <span class='<%=(Boolean)categoryList.get(i).get("wifi") == true ? "icon-ok" : ""%> text-primary'></span>
                                            </td>
                                            <td class="hidden-phone" form-data="bathroom">
                                                <span class='<%=(Boolean)categoryList.get(i).get("bathroom") == true ? "icon-ok" : ""%> text-primary'></span>
                                            </td>
                                            <td class="hidden-phone" form-data="area"><%=categoryList.get(i).get("area_min") + " ~ " + categoryList.get(i).get("area_max") + "mm" %></td>
                                            <td class="hidden-phone">
                                                <a href='./hotel_booking.jsp?id=<%=categoryList.get(i).get("id") %>'>
                                                    <button class="btn btn-info btn-xs" type="button">
                                                        <i class="icon-edit"></i> Book
                                                    </button>
                                                </a>
                                            </td>
                                        </tr> 
                                    <%
                                        }
                                    %>
                                    </tbody>
                                </table>
                            </div>
                        </section>
                    </div>
                </div>
            </section>
        </section>
        <!--main content end-->
    </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="../Public/js/jquery.js"></script>
    <script src="../Public/js/jquery-1.8.3.min.js"></script>
    <script src="../Public/js/bootstrap.min.js"></script>
    <script src="../Public/js/jquery.scrollTo.min.js"></script>
    <script src="../Public/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="../Public/js/jquery.sparkline.js" type="text/javascript"></script>
    <script src="../Public/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>
    <script src="../Public/js/owl.carousel.js"></script>
    <script src="../Public/js/jquery.customSelect.min.js"></script>

    <!--common script for all pages-->
    <script src="../Public/js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="../Public/js/sparkline-chart.js"></script>
    <script src="../Public/js/easy-pie-chart.js"></script>

    <script>
        //owl carousel

      $(document).ready(function() {
          $("#owl-demo").owlCarousel({
              navigation : true,
              slideSpeed : 300,
              paginationSpeed : 400,
              singleItem : true

          });
      });

      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });
    </script>
    
    <!--scripted by myself-->
    <script>
        $(document).ready(function(){
            $("#Hotel_Service").addClass("active");
            $("#hotel_index").addClass("active");
        });
    </script>


</body>

</html>
<%
    }
    room.close();
%>